"use strict";
import axios from 'axios';

export default {
  getTravelCost(params){//部门差旅支出
    /*var data = {
      code: '0',
      data: {
        year: 2018,//年
        month: 4,//月
        cost: 142122,//当月消费总金额
        increasePercent: '10.4%',//环比增长
        budgetCostPercent: '--',//预算消费
        orderTypeData: [{//订单类型统计数据
          bizType: '10',//机票类型
          monthCost201803: 120000,//2018年3月机票消耗金额
          monthCost201804: 110000//2018年4月机票消耗金额
        }, {
          bizType: '12',//火车
          monthCost201803: 8500,
          monthCost201804: 10000
        }, {
          type: '11',//酒店
          name: '酒店',
          monthCost201803: 11000,
          monthCost201804: 23000
        }, {
          type: 'other',//其它
          monthCost201803: 10000.5,
          monthCost201804: 13331.3
        }],
        travelTypeData: [{//出行类别统计数据
          type: '001',
          name: '拜访客户',
          monthCost201803: 332288,//2018年3月'拜访客户'消耗金额
          monthCost201804: 405000//2018年4月'拜访客户'消耗金额
        }, {
          type: '002',
          name: '开会培训',
          monthCost201803: 12000,
          monthCost201804: 10000
        }, {
          type: '003',
          name: '技术支持',
          monthCost201803: 87550,
          monthCost201804: 12000
        }, {
          type: '004',
          name: '奖励旅游',
          monthCost201803: 6500,
          monthCost201804: 7000
        }],
        months: ['2018-02', '2018-03', '2018-04', '2018-05', '2018-06', '2018-07'],//当前组织最近6月消费数据
        monthOrderTypeData: {//不同订单类型的近6月份数据
          '10': [56441, 32220, 2300, 11000, 22200, 1000],//机票2月到7月消费金额
          '11': [1200, 333, 122, 4444, 55551],//酒店2月到7月消费金额
          '12': [1200, 333, 122, 4444, 55551],//火车2月到7月消费金额
          '13': [0, 120, 7630, 1233, 332230]//其它2月到7月消费金额
        },
        monthTravelTypeData:{
          '001': [11133, 2222, 33334, 4432, 1111, 0],//拜访客户2月到7月消费金额
          '002': [3332, 7767, 8777, 76, 4423],//开会培训2月到7月消费金额
          '003': [233, 2331, 90, 88, 6666],//技术支持2月到7月消费金额
          '004': [110, 555, 733, 865, 789]//奖励旅游2月到7月消费金额
        },
        orgChildrenData: [{//下级组织消费金额
          orgId: 11,//组织id
          orgName: '总裁办',//组织名称
          monthData:[7650,1233,4440,3312,9873,4443]//总裁办2月到7月消费金额
        }, {
          orgId: 12,
          orgName: '技术部',
          monthData:[330,1113,3223,8770,32323,9880]//技术部2月到7月消费金额
        }, {
          orgId: 13,
          orgName: '产品部',
          monthData:[330,3333,44,8770,44,0]
        }, {
          orgId: 14,
          orgName: '企划部',
          monthData:[1323,3232,323,778,44,0]
        }, {
          orgId: 15,
          orgName: '运营部',
          monthData:[1233,434,4433,44423,44,0]
        }, {
          orgId: 16,
          orgName: '运维部',
          monthData:[0,444,555,980,44,0]
        }]
      },
      msg: ''
    };*/

    //return Promise.resolve({code:'0',data});
    return axios.get('bi/getTravelCost.json', {
      params: params
    });
  },
  getReduceData(params){//部门差旅节支
    /*var data = {
      reduceData: [{//已省金额各项数据
        type:'001',
        name:'低价航班替换',
        reduceMoney:6789450,//节省金额，精确到分
      },{
        type:'002',
        name:'协议航司',
        reduceMoney:136550,
      },{
        type:'003',
        name:'协议酒店',
        reduceMoney:2123300,
      }],
      canReduceData:[{//可省金额各项数据
        type:'001',
        name:'低价航班替换',
        reduceMoney:23450,//可节省金额，精确到分
      }],
      monthData:[{//近6月节省/可节省统计数据，按时间排序
        month:'2017-12',
        reduceMoney:78850,//节省总金额
        canReduceMoney:45650//可节省总金额
      },{
        month:'2018-01',
        reduceMoney:88850,
        canReduceMoney:51120
      },{
        month:'2018-02',
        reduceMoney:108850,
        canReduceMoney:81120
      },{
        month:'2018-03',
        reduceMoney:51850,
        canReduceMoney:31120
      },{
        month:'2018-04',
        reduceMoney:98850,
        canReduceMoney:61120
      },{
        month:'2018-05',
        reduceMoney:128850,
        canReduceMoney:61120
      }]
    };

    return Promise.resolve(data);*/

    return axios.get('bi/getReduceData.json',{params});
  },
  getTypeReduceData(params){//获取某统计类型的节支明细
    params = {
      type:'A',//A:已省金额明细查询，B:可省金额明细查询
      bizType:'001',//查询业务类型
      currentPage:1,
      pageSize:20,
      userName:'三'//用户姓名like
    };
    var data = {
      type:'A',//可省节支明细
      bizType:'001',
      bizName:'低价航班替换',
      currentPage:1,
      totalPage:10,
      list:[{
        orderId:123,
        bookTime:'2018-06-12 12:12:33',//预定时间
        bookUserId:12,//预定用户id
        bookUserName:'涨三',//预定用户名称
        title:'上海-武汉 2018-06-18 19:12起飞 经济舱 参加小米发布会',
        reduceMoney:22300,//节省金额/可省金额
        flightInfo:null,//原选择航班信息（at A已省-低价航班替换）/推荐航班信息（at B可省-低价航班替换）
        orginPrice:324300,//原始票价总额(at已省-协议航司/协议酒店)
        protocolPrice:302000,//协议价格总额(at已省-协议航司/协议酒店)
        noLowerPriceReason:'机票已售空'//未选择低价航班原因（at B可省-低价航班替换）
      }]
    };

    return Promise.resolve({
      code:'0',
      data:data
    })

    return axios.get('bi/getTypeReduceData.json',{});
  },
  getIllegalData(params){//部门员工违规记录
    params = {
      orgId:1,
      year:2018,
      month:4
    };

    var data = {
      typeData:[{//部门当月分类型统计违规次数
        type:'001',
        name:'未提前预定',
        illegalCount:124//违规次数
      },{
        type:'002',
        name:'未选择最低价',
        illegalCount:34
      },{
        type:'003',
        name:'无差旅计划',
        illegalCount:564
      },{
        type:'004',
        name:'超出差旅标准',
        illegalCount:90
      },{
        type:'005',
        name:'超出计划金额',
        illegalCount:10
      }],
      orgChildrenData:[{//下级部门违规数据
        orgId:1,
        orgName:'产品部',
        orderCount:3122,//订单总数
        illegalCount:124//违规次数
      },{
        orgId:2,
        orgName:'设计部',
        orderCount:689,
        illegalCount:32
      },{
        orgId:2,
        orgName:'设计部',
        orderCount:689,
        illegalCount:32
      },{
        orgId:3,
        orgName:'销售部',
        orderCount:1592,
        illegalCount:143
      },{
        orgId:4,
        orgName:'开发部',
        orderCount:56,
        illegalCount:2
      }],
      userData:[{//当前单位及下属所有单位中的员工违规数据，根据违规次数排序取前10个
        userId:1001,
        userName:'王小猫',
        orderCount:30,
        illegalCount:10
      },{
        userId:1002,
        userName:'二木',
        orderCount:25,
        illegalCount:8
      },{
        userId:1003,
        userName:'为良苏',
        orderCount:15,
        illegalCount:3
      },{
        userId:1004,
        userName:'涨三',
        orderCount:10,
        illegalCount:3
      }],
      monthData:[{//查询部门月份违规统计数据:近6月违规数据（往前推）
        month:'2017-12',
        illegalCount:134
      },{
        month:'2018-01',
        illegalCount:154
      },{
        month:'2018-02',
        illegalCount:80
      },{
        month:'2018-03',
        illegalCount:213
      },{
        month:'2018-04',
        illegalCount:269
      },{
        month:'2018-05',
        illegalCount:156
      }]
    };

  }

};
